<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<f:loadBundle basename="com.es.resource.messages" var="bundle" />

<html>
	<head>
		<base href="<%=basePath%>">

		<title>Equi Sales CRM Solution</title>



	</head>

	<body>
		<f:view>

			<a4j:form>

				<div align="center">

					<rich:panel header="Login please..." style="width:315px;"
						id="mainPanel">


						<rich:spacer height="10"></rich:spacer>
				
						<h:outputText value="User code: " />
						<h:inputText required="true" requiredMessage="Please enter your user code"
							value="#{authenticationController.userCode}" id="userCodeInput">
							<a4j:support id="code" event="onblur" reRender="user_code_err_msg"
								ajaxSingle="true" limitToList="true" />
						</h:inputText>
						<br />

						<rich:message id="user_code_err_msg" for="userCodeInput"
							style='color:red; font-size: 11px;' showDetail="false"
							showSummary="true"></rich:message>

						<f:verbatim>
							<br />
						</f:verbatim>


						<h:outputText value="Password: " />
						<h:inputSecret required="true"
							requiredMessage="Please enter password"
							 value="#{authenticationController.password}" 
							id="password_com">
							<a4j:support id="pass" event="onblur" reRender="password_msg"
								ajaxSingle="true" limitToList="true" />
						</h:inputSecret>
						<br />
						<rich:message id="password_msg" for="password_com"
							style='color:red; font-size: 11px;' showDetail="false"
							showSummary="true"></rich:message>

						<f:verbatim>
							<br />
						</f:verbatim>
						
						<h:commandButton value="Login"
							action="#{authenticationController.login}" id="login" />

					</rich:panel>
				</div>
			</a4j:form>

		</f:view>
	</body>
</html>